﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace CCC
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            timer1.Enabled = true;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            // 輸入check
            string input = textBox1.Text;
            string pat = "^[0-9]{1,5}$";
            if (!Regex.IsMatch(input, pat))
            {
                MessageBox.Show("輸入有錯！");
            }
            else
            {
                go_calc();
            }
        }

        private void go_calc()
        {
            go_R1();
            go_R2();
            go_R3();
            go_R4();
            go_R5();
            go_R6();
            go_R7();
            go_R8();
            go_R9();
            go_R10();
            go_R11();
            go_R12();
            go_R13();
            go_R14();
            go_R15();
            go_R16();
        }

        private void textBox26_TextChanged(object sender, EventArgs e)
        {

        }

        private void go_R1()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas * (1 + 0.009026));
            R1V.Text = v.ToString();
        }

        private void go_R2()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas * (1 + 0.007177));
            R2V.Text = v.ToString();
        }

        private void go_R3()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas * (1 + 0.005437));
            R3V.Text = v.ToString();
        }

        private void go_R4()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas * (1 + 0.003588));
            R4V.Text = v.ToString();
        }

        private void go_R5()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas * (1 + 0.002718));
            R5V.Text = v.ToString();
        }

        private void go_R6()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas * (1 + 0.001848));
            R6V.Text = v.ToString();
        }

        private void go_R7()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas * (1 + 0.000978));
            R7V.Text = v.ToString();
        }

        private void go_R8()
        {
            double bas = double.Parse(textBox1.Text);
            double v = bas;
            R8V.Text = v.ToString();
        }

        private void go_R9()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas - bas * (1 - 0.999129));
            R9V.Text = v.ToString();
        }

        private void go_R10()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas - bas * (1 - 0.998151));
            R10V.Text = v.ToString();
        }

        private void go_R11()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas - bas * (1 - 0.997281));
            R11V.Text = v.ToString();
        }

        private void go_R12()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas - bas * (1 - 0.996411));
            R12V.Text = v.ToString();
        }

        private void go_R13()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas - bas * (1 - 0.994671));
            R13V.Text = v.ToString();
        }

        private void go_R14()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas - bas * (1 - 0.99293));
            R14V.Text = v.ToString();
        }

        private void go_R15()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas - bas * (1 - 0.990973));
            R15V.Text = v.ToString();
        }

        private void go_R16()
        {
            double bas = double.Parse(textBox1.Text);
            double v = Math.Round(bas - bas * (1 - 0.989015));
            R16V.Text = v.ToString();
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Return)
            {
                go_calc();
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            webBrowser1.Refresh();
        }
    }
}
